/**
 * Created by 145185 on 2017/6/3.
 */
var pcUtil = {
  /**
   * 处理用户反馈字段
   * @param date
   * @returns {*}
   */
  dealFeedback:function(data){
    let str;
    switch (data){
      case 0:str='';break;
      case 1:str='未解决';break;
      case 2:str='已解决';break;
    }
    return str;
  },
  /**
   * 处理处理方式字段
   * @param date
   * @returns {*}
   */
  dealDealWay:function(data){
    let str;
    switch (data){
      case 1:str='大赞门城';break;
      case 2:str='举报处理';break;
    }
    return str;
  },
  /**
   * 处理用户提交内容长度
   * @param content
   * @returns {*}
   */
  dealSubmitContent:function(content){
    let str;
    if(content.length > 90){
      str = content.replace(/[\r\n]/g,'').trim().substr(0,90)+ "…";
    }else{
      str = content;
    }
    return str;
  },
  /**
   * 获取当天和明天
   * @returns {Array}
     */
  getPublicTime:function(){
    let date1 = new Date(),arr=[];
    let date2 = new Date(date1.getTime()+24*60*60*1000);
    let year=date1.getFullYear(),
        month=date1.getMonth()+1,
        day=date1.getDate();
    let year1=date2.getFullYear(),
        month1=date2.getMonth()+1,
        day1=date2.getDate();
    arr[0]=year+'-'+month+'-'+day+" 00:00";
    arr[1]=year1+'-'+month1+'-'+day1+" 00:00";
    return arr;
  },
  /**
   * 字符串换取时间戳
   * @param date
   * @returns {number}
     */
  date2TimeStamp:function(date){
    return new Date(date).getTime();
  },
  textLength:function (val,num) {
    var length = val.replace(/[\r\n]/g,'**').length;
    if(length>num){
      length =num;
    }
    return length;
  }
}

export default pcUtil ;
